package com.mianyang.zhangsan.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mianyang.zhangsan.model.entity.SecPaperPro;
import com.mianyang.zhangsan.service.SecPaperProService;
import com.mianyang.zhangsan.mapper.SecPaperProMapper;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

/**
* @author jiangjr
*/
@Service
public class SecPaperProServiceImpl extends ServiceImpl<SecPaperProMapper, SecPaperPro>
    implements SecPaperProService{

    @Override
    public List<Long> selectProblemsByPaperInstId(Long paperInstId) {
        QueryWrapper<SecPaperPro> wrapper = new QueryWrapper<>();
        if (paperInstId != null) {
            wrapper.eq("paper_inst_id", paperInstId);
            List<SecPaperPro> problems = list(wrapper);
            return problems.stream()
                    .map(SecPaperPro::getProblemInstId)
                    .collect(Collectors.toList());
        }
        return null;
    }
}




